<?php require_once('connections/con_gl.php'); ?>
<?php
cekAkses($_SESSION[akses],"DD-1");
mysql_select_db($database_con_gl, $con_gl);
$query_klas = "SELECT kd, klasifikasi FROM gl_klas ORDER BY kd,klasifikasi ASC";
$klas = mysql_query($query_klas, $con_gl) or die(mysql_error());
$row_klas = mysql_fetch_assoc($klas);
$totalRows_klas = mysql_num_rows($klas);
?>
<link type="text/css" rel="stylesheet" href="css/jquery.wysiwyg.css" />
<script type="text/javascript" src="js/jquery.wysiwyg.js"></script>
<script type="text/javascript">
$(document).ready(function() {

	$().ajaxStart(function() {
		$('#loading').show();
		$('#result').hide();
	}).ajaxStop(function() {
		$('#loading').hide();
		$('#result').fadeIn('slow');
	});

	$('#add').submit(function() {
		$.ajax({
			type: 'POST',
			url: $(this).attr('action'),
			data: $(this).serialize(),
			success: function(data) {
				$('#result').html(data);
			}
		})
		return false;
	});
  $('#result').click(function(){
  $(this).hide();
  });
})
$(function()
  {
      $('#keterangan').wysiwyg();
  });
</script>
<script>
function sendRespondKlasifikasi() {
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('divKlasifikasi');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
		if (ajaxRequest.readyState == 3) {
			var ajaxDisplay = document.getElementById('divKlasifikasi');
			ajaxDisplay.innerHTML = "<img src='images/ajax-loader.gif' />";
		}
	}
	ajaxRequest.open("GET", "include/send_respondklasifikasi.php", true);
	ajaxRequest.send(null);	
}
</script>

<div id="loading" style="display:none;"><img src="images/loading.gif" alt="loading..." /></div>
<div id="result" style="display:none;"></div>
<h1>Tambah Akun</h1>
<form action="proses/akun.php?act=add" method="post" name="add" id="add">
  <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0" class="datatable">
    <tr valign="top">
      <td width="21%" align="right" bgcolor="#FFFFFF">Klasifikasi* : </td>
      <td width="79%" bgcolor="#FFFFFF"><label id='divKlasifikasi'>
        <select name="klasifikasi" id="klasifikasi" style="width:230px;">
          <?php
do {  
?>
          <option value="<?php echo $row_klas['kd']?>"><?php echo $row_klas['kd']?> - <?php echo $row_klas['klasifikasi']?></option>
          <?php
} while ($row_klas = mysql_fetch_assoc($klas));
  $rows = mysql_num_rows($klas);
  if($rows > 0) {
      mysql_data_seek($klas, 0);
	  $row_klas = mysql_fetch_assoc($klas);
  }
?>
        </select>
      </label><?php if(strstr($_SESSION['akses'],"A-3")) { ?><a href="index.php?component=klasifikasiakun&task=add&open=window" onclick="NewWindow(this.href,'name','825','500','yes');return false"><img src="images/add_.png" hspace="2" border="0" /></a><?php } ?></td>
    </tr>
    <tr valign="top">
      <td align="right" bgcolor="#FFFFFF">Area* : </td>
      <td bgcolor="#FFFFFF"><?php
		if(!strstr($_SESSION[akses],'A-1-4')) {	
		 /* Added by suwondo */
		echo "<input type='hidden' name='area' id='area' value='$_SESSION[area]' />";
		list($namaarea) = mysql_fetch_row(mysql_query("select area from gl_area where id= '$_SESSION[area]'"));
		echo "<input type='text' name='txtarea' id='txtarea' size='28' readonly style='background-color:#fff;border:1px solid #999; height:16px;' value='$namaarea'  />";
		}else{
		?>
          <!-- Added by suwondo -->
          <input type="hidden" name="area" id="area" />
          <input type="text" name="txtarea" id="txtarea" size="28" readonly="readonly" style="background-color:#fff;border:1px solid #999; height:16px;" onclick="NewWindow('index.php?component=area&amp;task=list&amp;open=window','name','825','450','yes');return false" />
          <?php if(strstr($_SESSION['akses'],"PD-6-1")) { ?>
          <a href="index.php?component=area&amp;task=add&amp;open=window" onclick="NewWindow(this.href,'name','825','450','yes');return false"><img src="images/add_.png" hspace="2" border="0" style="position:absolute;" /></a>
          <?php }} ?>      </td>
    </tr>
    <tr valign="top">
      <td align="right" bgcolor="#FFFFFF">Cabang* : </td>
      <td bgcolor="#FFFFFF"><?php
		if(!strstr($_SESSION[akses],'A-1-4')) {	
		 /* Added by suwondo */
		echo "<input type='hidden' name='cabang' id='cabang' value='$_SESSION[lokasi]' />";
		list($namalokasi) = mysql_fetch_row(mysql_query("select gudang from gl_gudang where id= '$_SESSION[lokasi]'"));
		echo "<input type='text' name='txtcabang' id='txtcabang' size='28' readonly style='background-color:#fff;border:1px solid #999; height:16px;' value='$namalokasi'  />";
		}else{
		?>
          <!-- Added by suwondo -->
          <input type="hidden" name="cabang" id="cabang" />
          <input type="text" name="txtcabang" id="txtcabang" size="28" readonly="readonly" style="background-color:#fff;border:1px solid #999; height:16px;" onclick="NewWindow('index.php?component=gudang&amp;task=list&amp;area='+document.getElementById('area').value+'&amp;open=window','name','825','450','yes');return false" />
          <?php if(strstr($_SESSION['akses'],"PD-7-1")) { ?>
          <a href="index.php?component=gudang&amp;task=add&amp;area='+document.getElementById('area').value+'&amp;open=window" onclick="NewWindow(this.href,'name','825','450','yes');return false"><img src="images/add_.png" hspace="2" border="0" style="position:absolute;" /></a>
          <?php } } ?>      </td>
    </tr>
    
    <tr>
      <td align="right" bgcolor="#FFFFFF">Akun ID*: </td>
      <td bgcolor="#FFFFFF"><label>
        <input name="akunID" type="text" id="akunID" size="30" maxlength="15"/>
      (number only) </label></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#FFFFFF">Nama Akun*: </td>
      <td bgcolor="#FFFFFF"><label>
        <input name="namaAkun" type="text" id="namaAkun" size="30" maxlength="200"/>
      </label></td>
    </tr>
    <tr valign="top">
      <td align="right" bgcolor="#FFFFFF">Saldo Awal*: </td>
      <td bgcolor="#FFFFFF"><label>
        <select name="pos" id="pos" style="width:100px;">
          <option value="D">Debet</option>
          <option value="K">Kredit</option>
        </select>
		</label>
		<label>
        <input name="saldo" type="text" id="saldo" size="17" maxlength="20" />
      (number only) </label></td>
    </tr>
    <tr valign="top">
      <td align="right" bgcolor="#FFFFFF">Keterangan : </td>
      <td bgcolor="#FFFFFF"><label>
        <textarea name="keterangan" cols="85" rows="5" id="keterangan"></textarea>
      </label></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#FFFFFF">Arus Kas </td>
      <td bgcolor="#FFFFFF"><label>
        <select name="aruskas" id="aruskas">
          <option value="0" selected="selected">Tidak diset</option>
          <option value="1">Operasi - Aktiva Lancar</option>
          <option value="2">Operasi - Kewajiban Lancar</option>
          <option value="3">Investasi</option>
          <option value="4">Pendanaan</option>
        </select>
      </label></td>
    </tr>
    <tr>
      <td align="left" bgcolor="#FFFFFF"><em>*Harus diisi<input name="open" type="hidden" id="open" value="<?php echo $_GET['open'];?>" /></em></td>
      <td bgcolor="#FFFFFF"><label>
        <input name="Save" type="submit" id="Save" value="Simpan" />
        </label>
          <label>
          <input type="button" name="Button" value="Batal" onclick="javascript:<?php if($_GET['open']=='window') { ?>window.close(2000);<?php }else{ ?>history.go(-1);<?php } ?>" />
        </label></td>
    </tr>
  </table>
  <input type="hidden" name="MM_insert" value="add" />
  <input type="hidden" name="MM_update" value="add" />
</form>
</body>
</html>
